package org.jeecg.modules.sggg.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.modules.sggg.entity.SgDeviceRelevance;
import org.jeecg.modules.sggg.mapper.SgDeviceRelevanceMapper;
import org.jeecg.modules.sggg.service.ISgDeviceRelevanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;
import java.util.Map;

/**
 * @Description: 设备关联表
 * @Author: jeecg-boot
 * @Date: 2023-03-19
 * @Version: V1.0
 */
@Service
public class SgDeviceRelevanceServiceImpl extends ServiceImpl<SgDeviceRelevanceMapper, SgDeviceRelevance> implements ISgDeviceRelevanceService {

    @Autowired
    private SgDeviceRelevanceMapper sgDeviceRelevanceMapper;

    @Override
    public IPage<SgDeviceRelevance> getDoctorAuthority(IPage<SgDeviceRelevance> page, String userId, String sysOrgCode, String roleCode, SgDeviceRelevance sgDeviceRelevance, String selectOrgCode) {
        String type = "";
        if (sgDeviceRelevance.getType() != null) {
            type = sgDeviceRelevance.getType().toString();
        }
        return sgDeviceRelevanceMapper.getDoctorAuthority(page, userId, sysOrgCode, roleCode, sgDeviceRelevance.getSerialNumber(), sgDeviceRelevance.getMemberName(), type, sgDeviceRelevance.getResponsibleAgencies(), selectOrgCode);
    }

    @Override
    public IPage<SgDeviceRelevance> queryPageListBySql(Page<SgDeviceRelevance> page, SgDeviceRelevance cronJobList) {
        List<SgDeviceRelevance> cronJobLists = sgDeviceRelevanceMapper.queryPageListBySql(page, cronJobList);
        return page.setRecords(cronJobLists);
    }

    @Override
    public List<SgDeviceRelevance> provideDeviceCount(String type, String userId, List<String> responsibleAgencies, String sysOrgCode) {
        return sgDeviceRelevanceMapper.provideDeviceCount(type, userId, responsibleAgencies, sysOrgCode);
    }
}
